import openai
#主循环
def openai_chat(question):
    api_key = "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"
    openai.api_key = api_key

    #获取用户输入的问题
    #question = input("请输入问题：")

    #调用openai的api
    completion = openai.ChatCompletion.create(
        model="gpt-3.5-turbo",
        messages=[{"role": "user",
                     "content": question}],
        max_tokens=4000,
        temperature=0.8,
    )
    #打印答案
    return completion["choices"][0]["message"]["content"]